package com.smart.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smart.entity.Notice;
import com.smart.mapper.NoticeMapper;
import com.smart.service.INoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Cookies
 * @since 2024-05-06
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {
    @Autowired
    NoticeMapper noticeMapper;

    @Override
    public List<Notice> getNoticeList() {
        IPage iPage = new Page(1, 5);
        IPage page = lambdaQuery()
                .orderByDesc(Notice::getId)
                .page(iPage);
        return page.getRecords();
    }
}
